﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using CarolLib.Configuration;

namespace DCS.Configuration
{
    public class FTPDownloadSetting
    {
        public FTPDownloadSetting(XmlNode node)
        {
            XmlAttributeCollection atts = node.Attributes;
            this.RemoteServer = ConfigurationBase.GetStringAttribute(atts, "remoteserver", string.Empty);
            this.RemotePath = ConfigurationBase.GetStringAttribute(atts, "remotepath", string.Empty);
            this.UserName = ConfigurationBase.GetStringAttribute(atts, "username", string.Empty);
            this.Password = ConfigurationBase.GetStringAttribute(atts, "password", string.Empty);
            this.LocalPath = ConfigurationBase.GetStringAttribute(atts, "localpath", string.Empty);
            this.RecentDays = ConfigurationBase.GetIntAttribute(atts, "recentdays", 365);
            this.DownloadInterval = ConfigurationBase.GetIntAttribute(atts, "downloadinterval", 3000);
            this.DownImmediately = ConfigurationBase.GetBoolAttribute(atts, "downimmediately", false);
            this.MessageType = ConfigurationBase.GetStringAttribute(atts, "messagetype", string.Empty);
            this.CleanInterval = ConfigurationBase.GetIntAttribute(atts, "cleaninterval", 3000);
            this.EnableClean = ConfigurationBase.GetBoolAttribute(atts, "enableclean", false);
        }

        #region Properties

        public string RemoteServer { get; set; }
        public string RemotePath { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }
        public string LocalPath { get; set; }
        public int RecentDays { get; set; }
        public int DownloadInterval { get; set; }
        public bool DownImmediately { get; set; }
        public int CleanInterval { get; set; }
        public bool EnableClean { get; set; }
        public string MessageType { get; set; }

        #endregion
    }
}
